<template>
	<view>
		<view class="content-swiper">
			<swiper-dot :info="info" :current="current" mode="default" :dotsStyles="dotsStyles">
				<swiper class="swiper" circular :autoplay="true" :interval="2000" :duration="500" @change="change">
					<swiper-item v-for="(item,index) in info" :key="index" @click="swiperTo(index)">
						<image class="swiper-image" mode="aspectFill" :src="item.url"></image>
					</swiper-item>
				</swiper>
			</swiper-dot>
		</view>
		<view class="content-box">
			<view class="content-item">
				<view class="box-left" @click="todayTo">
					<image class="item-ico1" src="../../static/ico-1.png"></image>
					<view class="item-text" >
						News Today
					</view>
				</view>
				<view class="box-right">
					<view class="box-top" @click="reportsTo">
						<image class="item-ico2"  src="../../static/ico-2.png"></image>
						<view class="item-text" >
							Reports
						</view>
					</view>
					<view class="box-bottom" @click="libraryTo">
						<view class="item-text" >
							Library
						</view>
						<image class="item-ico2"  src="../../static/ico-3.png"></image>
					</view>
				</view>
			</view>
			<view class="content-link">
				Links
			</view>
			<view class="content-bottom-box">
				<view class="bottom-box box1" @click="linkTo(1)">
					<image class="item-ico2" src="../../static/ico-4.png"></image>
					<view class="item-text">
						Gfk StarTrack
					</view>
				</view>
				<view class=" bottom-box box2" @click="linkTo(2)">
					<image class="item-ico2" src="../../static/ico-5.png"></image>
					<view class="item-text">
						TraQline
					</view>
				</view>
				<view class="bottom-box box3" @click="linkTo(3)">
					<image class="item-ico3" src="../../static/ico-6.png"></image>
					<view class="item-text" style="margin-top: 5px;">
						更多
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import swiperDot from '@/components/swiper-dot/swiper-dot.vue'
	export default {
		components: {
			swiperDot
		},
		data() {
			return {
				current: 0, //当前位置索引值
				dotsStyles: {
					width: 15
				},
				info: [{
						url: 'http://cdn.pandaps.cn/chervon-swipter-1.png',
					},
					{
						url: 'http://cdn.pandaps.cn/chervon-swipter-2.png',
					},
					{
						url: 'http://cdn.pandaps.cn/chervon-swipter-3.png',
					}
				],
			}
		},
		methods: {
			change(e) {
				this.current = e.detail.current
			},
			swiperTo(index) {
				//图片轮播跳转
				uni.navigateTo({
					url: `../web-view/wev-view?type=url&url=https://www.baidu.com/`
				});
			},
			todayTo() {
				console.log('todayTo------')
				//今日跳转
				uni.navigateTo({
					url: '../news/news'
				});
			},
			reportsTo() {
				console.log('reportsTo------')
				//报告跳转
				uni.navigateTo({
					url: '../reports/reports'
				});
			},
			libraryTo() {
				console.log('libraryTo------')
				//文件跳转
				uni.navigateTo({
					url: '../library/library'
				});
			},
			linkTo(index) {
				switch (index) {
					case 1:
						uni.navigateTo({
							url: `../web-view/wev-view?type=url&url=https://traqline.stevensoncompany.com/login.php`
						});
						break;
					case 2:
						uni.navigateTo({
							url: `../web-view/wev-view?type=url&url=https://startrack.gfkrt.com/portal/default.aspx`
						});
						break;
					case 3:
						uni.navigateTo({
							url: `../web-view/wev-view?type=url&url=https://www.baidu.com/`
						});
						break;
				}
			}
		}
	}
</script>

<style scoped="scoped" lang="less">
	.content-swiper {
		width: 100vw;
	}

	.swiper {
		height: 40vh;

		.swiper-image {
			width: 100%;
			height: 36vh;
		}
	}

	.content-box {
		padding: 10rpx;

		.item-ico1 {
			width: 100rpx;
			height: 100rpx;
		}

		.item-ico2 {
			width: 80rpx;
			height: 80rpx;
		}

		.item-ico3 {
			width: 70rpx;
			height: 15rpx;
		}

		.content-item {
			// padding: 1vw;
			height: 320rpx;
			display: flex;
			justify-content: flex-start;
			flex-direction: row;
			align-items: center;

			.box-left {
				margin: 1vw;
				width: 40%;
				height: 320rpx;
				background: #1eb2fa;
				color: #FFFFFF;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;

				.item-text {
					font-size: 32rpx;
				}
			}

			.box-right {
				margin: 1vw;
				width: 60%;
				height: 320rpx;
				display: flex;
				flex-direction: column;

				.box-top {
					height: 170rpx;
					background: #ffa72c;
					color: #FFFFFF;
					display: flex;
					flex-direction: row;
					justify-content: center;
					align-items: center;

					.item-text {
						margin-left: 60rpx;
						font-size: 32rpx;
					}
				}

				.box-bottom {
					height: 140rpx;
					background: #039c88;
					margin-top: 10rpx;
					color: #FFFFFF;
					display: flex;
					flex-direction: row;
					justify-content: center;
					align-items: center;

					.item-text {
						margin-right: 60rpx;
						font-size: 32rpx;
					}
				}
			}
		}

		.content-link {
			height: 50rpx;
			margin: 30rpx 0 10rpx 1vw;
			padding-left: 20rpx;
			border-left: 5px solid #3b97ee;
			font-weight: 600;
			font-family: "微软雅黑";
			color: #3b97ee;
		}

		.content-bottom-box {
			height: 180rpx;
			display: flex;
			justify-content: space-between;
			flex-direction: row;
			margin: 10px 0 0 0;
			color: #FFFFFF;

			.bottom-box {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
			}

			.box1 {
				width: 39%;
				background: #22223c;
			}

			.box2 {
				width: 29%;
				background: #ab006a;
			}

			.box3 {
				width: 29%;
				background: #22223c;
			}
		}
	}
</style>
